
<html><head>
<title>flexoutput - flibs</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.toc,UL.toc UL, UL.toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.section, LI.subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.requirements LI, UL.syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<! -- Generated from file 'flexoutput.man' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2016 Arjen Markus &lt;arjenmarkus at sourceforge dot net&gt;
   -->
<! -- CVS: $Id: flexoutput.html,v 1.1 2016/10/23 12:22:57 arjenmarkus Exp $ flexoutput.n
   -->
<body><div class="doctools">
<h1 class="title">flexoutput(n) 1.0  &quot;flibs&quot;</h1>
<div id="name" class="section"><h2><a name="name">Name</a></h2>
<p>flexoutput - Output facility with flexible substitution</p>
</div>
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="toc">
<li class="section"><a href="#toc">Table Of Contents</a></li>
<li class="section"><a href="#synopsis">Synopsis</a></li>
<li class="section"><a href="#section1">Description</a></li>
<li class="section"><a href="#section2">ROUTINES</a></li>
<li class="section"><a href="#copyright">Copyright</a></li>
</ul>
</div>
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="synopsis">
<ul class="syntax">
<li><a href="#1"><b class="cmd">call write_items( lun, format, item_array, advance )</b></a></li>
<li><a href="#2"><b class="cmd">arg = item( var )</b></a></li>
</ul>
</div>
</div>
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
<p>The <i class="term">flexoutput</i> module allows you to output strings with arguments substituted via simple codes
within the string. For example:</p>
<pre class="example">
    call write_items( 10, 'The value of {2} is {1}, as expected', [ item(1), item('Name') ] )
</pre>
<p>would produce the string: <i class="term">The value of Name is 1, as expected</i></p>
<p>The function <i class="term">item</i> returns a value of the type <i class="term">item_t</i>, so that in the above
statement an array is constructed with integer and string values. These are then substituted
using default formatting specific to the data type. The result is written to a file.</p>
</div>
<div id="section2" class="section"><h2><a name="section2">ROUTINES</a></h2>
<p>There are two public routines:</p>
<dl class="definitions">
<dt><a name="1"><b class="cmd">call write_items( lun, format, item_array, advance )</b></a></dt>
<dd><p>This subroutine writes the string contained in the argument <i class="term">format</i> to the file at LU-number <i class="term">lun</i>.
Substrings like &quot;{1}&quot;, &quot;{2}&quot;, etc. are substitued by the corresponding element from the array <i class="term">item_array</i>. Use the
function <i class="term">item</i> to construct the array of items.</p>
<dl class="arguments">
<dt>integer, intent(in) <i class="arg">lun</i></dt>
<dd><p>LU-number of the file to write to.</p></dd>
<dt>character(len=*), intent(in) <i class="arg">format</i></dt>
<dd><p>Format string to be used.</p></dd>
<dt>type(item_t), dimension(:), intent(in) <i class="arg">item_array</i></dt>
<dd><p>Array specifying the variables. COnstruct it using the <i class="term">item</i> function.</p></dd>
<dt>logical, optional, intent(in) <i class="arg">advance</i></dt>
<dd><p>Explicitly advance or not at the end of writing the string. By default advance, so that the
next write statement starts on a new line.</p></dd>
</dl></dd>
<dt><a name="2"><b class="cmd">arg = item( var )</b></a></dt>
<dd><p>This function returns a value of type <i class="term">item_t</i>, so that an array can be formed
to be passed to <i class="term">write_items</i>. The argument <i class="term">var</i> is one of the basic types: integer,
single and double precision real or a character string of any length.</p>
<dl class="arguments">
<dt>scalar <i class="arg">var</i></dt>
<dd><p>The variable to be assigned a value from the input file.</p></dd>
</dl></dd>
</dl>
</div>
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
<p>Copyright &copy; 2016 Arjen Markus &lt;arjenmarkus at sourceforge dot net&gt;</p>
</div>
</div></body></html>